package com.ht.impl.demo;


import com.ht.impl.CustomGraphCompent;
import com.ht.impl.CustomGraphViewer;
import com.ht.impl.ViewerMenuBar;

import javax.swing.*;
import java.awt.*;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 *
 * @author Dong Shufeng
 *         Date: 2010-7-2
 */
public class GraphViewerDemo2 {

    public static void main(String[] args) throws IOException, InterruptedException {
        final CustomGraphCompent graphCompent = new CustomGraphCompent(true);
        graphCompent.getGraph().setCellsSelectable(true);
        graphCompent.getGraph().setCellsCloneable(false);
        graphCompent.getGraph().setCellsEditable(false);
        graphCompent.getGraph().setCellsMovable(false);
        CustomGraphViewer viewer = new CustomGraphViewer("", graphCompent);

        graphCompent.getViewport().setOpaque(false);
        graphCompent.setBackground(Color.BLACK);

        ViewerMenuBar viewerMenuBar = new ViewerMenuBar(viewer);
        JFrame frame = new JFrame();
        frame.setJMenuBar(viewerMenuBar);
        frame.add(viewer);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setPreferredSize(new Dimension(1024, 768));
        frame.pack();
        frame.setVisible(true);
    }
}